#ifndef _TEST_INTERSECT_2D_H_
#define _TEST_INTERSECT_2D_H_
#include <cppunit/extensions/HelperMacros.h>

class Test_intersect_2d : public CppUnit::TestFixture
{
	CPPUNIT_TEST_SUITE (Test_intersect_2d);
	CPPUNIT_TEST (test_orient_2d_01);
	CPPUNIT_TEST (test_orient_2d_02);
	CPPUNIT_TEST (test_orient_2d_03);

	CPPUNIT_TEST (test_seg_seg_01);
	CPPUNIT_TEST (test_seg_seg_02);
	CPPUNIT_TEST (test_seg_seg_03);
	CPPUNIT_TEST (test_seg_seg_04);
	CPPUNIT_TEST (test_seg_seg_05);

	/* Test segment co-linear*/
	CPPUNIT_TEST (test_seg_seg_co_01);
	CPPUNIT_TEST (test_seg_seg_co_02);
	CPPUNIT_TEST (test_seg_seg_co_03);
	CPPUNIT_TEST (test_seg_seg_co_04);
	CPPUNIT_TEST (test_seg_seg_co_05);
	CPPUNIT_TEST (test_seg_seg_co_06);

	/* Test 2D Segment intersection*/
	CPPUNIT_TEST (test_pol_pol_01);
	CPPUNIT_TEST (test_pol_pol_02);
	CPPUNIT_TEST (test_pol_pol_03);
	CPPUNIT_TEST (test_pol_pol_04);
	CPPUNIT_TEST (test_pol_pol_05);
	CPPUNIT_TEST (test_pol_pol_06);
	CPPUNIT_TEST (test_pol_pol_07);
	CPPUNIT_TEST (test_pol_pol_08);
	CPPUNIT_TEST (test_pol_pol_09);
	CPPUNIT_TEST (test_pol_pol_10);
	CPPUNIT_TEST (test_pol_pol_11);
	CPPUNIT_TEST (test_pol_pol_12);

	CPPUNIT_TEST_SUITE_END();

public :
	void setUp(){}
	void tearDown(){}


	/**
	 * Orient 2D positive 
	 */
	void test_orient_2d_01()
	{
		Vector<Value> a, b , c;
		a = Vector<Value> (Value (0.0), Value(0.0));
		b = Vector<Value> (Value (1.81), Value(1.81));
		c = Vector<Value> (Value (2.0), Value(2.01));

		CPPUNIT_ASSERT (0 < orient_2d(a, b, c));

		a = Vector<Value> (Value (0.0), Value(1e-54));
		b = Vector<Value> (Value (1.81), Value(1.81));
		c = Vector<Value> (Value (2.01), Value(2.01));

		CPPUNIT_ASSERT (0 < orient_2d(a, b, c));
	}

	/**
	 * Orient 2D Negative
	 */
	void test_orient_2d_02()
	{
		Vector<Value> a, b , c;
		a = Vector<Value> (Value (0.0), Value(0.0));
		b = Vector<Value> (Value (1.81), Value(1.81));
		c = Vector<Value> (Value (2.01), Value(2.002));

		CPPUNIT_ASSERT (0 > orient_2d(a, b, c));

		a = Vector<Value> (Value (0.0), Value(-1e-54));
		b = Vector<Value> (Value (1.81), Value(1.81));
		c = Vector<Value> (Value (2.01), Value(2.01));

		CPPUNIT_ASSERT (0 > orient_2d(a, b, c));
		
	}

	/**
	 * Orient 2D zero 
	 */
	void test_orient_2d_03()
	{
		Vector<Value> a, b , c;
		a = Vector<Value> (Value (1.80), Value(1.80));
		b = Vector<Value> (Value (1.81), Value(1.81));
		c = Vector<Value> (Value (1e103), Value(1e103));

		CPPUNIT_ASSERT (0 == orient_2d(a, b, c));

		a = Vector<Value> (Value (-1e-54), Value(-1e-54));
		b = Vector<Value> (Value (1.81), Value(1.81));
		c = Vector<Value> (Value (1e103), Value(1e103));

		CPPUNIT_ASSERT (0 == orient_2d(a, b, c));
			
	}
	/**
	 * Normal intersection.
	 */
	void test_seg_seg_01()
	{
		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.0), Value(0.0));
		b = Vector<Value> (Value (1.0), Value(1.0));

		c = Vector<Value> (Value (0.0), Value(1.0));
		d = Vector<Value> (Value (1.0), Value(0.0));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (0.5, 0.5));
	}

	/**
	 * End intersect End.
	 */
	void test_seg_seg_02()
	{

		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.17), Value(0.17));
		b = Vector<Value> (Value (1.0), Value(1.0));

		c = Vector<Value> (Value (0.17), Value(0.17));
		d = Vector<Value> (Value (1.0), Value(0.0));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (0.17, 0.17));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg3, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (0.17, 0.17));
	}

	/**
	 * One ends one internal part. 
	 */
	void test_seg_seg_03()
	{
		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.1), Value(0.1));
		b = Vector<Value> (Value (1.0), Value(1.0));

		c = Vector<Value> (Value (0.57), Value(0.57));
		d = Vector<Value> (Value (1.0), Value(0.0));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (0.57, 0.57));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg3, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (0.57, 0.57));
	}

	/**
	 * End - end. Two segments almost overlap. Actually, they intersect each other. 
	 */
	void test_seg_seg_04()
	{
		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.0), Value(0.0));
		b = Vector<Value> (Value (1.0), Value(0.0));

		c = Vector<Value> (Value (0.0), Value(1e-127));
		d = Vector<Value> (Value (1.0), Value(0.0));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (1.0, 0.0));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg3, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (1.0, 0.0));
	}
	/**
	 * Normal intersect. Two segments almost overlap. Actually, they intersect each other. 
	 */
	void test_seg_seg_05()
	{

		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.0), Value(0.0));
		b = Vector<Value> (Value (1.0), Value(0.0));

		c = Vector<Value> (Value (0.0), Value(1e-127));
		d = Vector<Value> (Value (1.0), Value(-1e-127));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		//std::cout<<res.point<<std::endl;
		CPPUNIT_ASSERT (res.point == VectorType (0.5, 0));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg3, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (0.5, 0));
	}

	/**
	 * Parallel no intersection. 
	 */
	void test_seg_seg_co_01()
	{
		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.1), Value(0.1));
		b = Vector<Value> (Value (1.13), Value(1.13));

		c = Vector<Value> (Value (2.15), Value(1.15));
		d = Vector<Value> (Value (2.17), Value(1.17));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (false == intersect_seg_seg_2d (seg1, seg2, res ));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (false == intersect_seg_seg_2d (seg1, seg3, res ));
	}

	/**
	 * co-linear no intersection. 
	 */
	void test_seg_seg_co_02()
	{
		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.1), Value(0.1));
		b = Vector<Value> (Value (1.13), Value(1.13));

		c = Vector<Value> (Value (1.15), Value(1.15));
		d = Vector<Value> (Value (1.17), Value(1.17));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (false == intersect_seg_seg_2d (seg1, seg2, res ));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (false == intersect_seg_seg_2d (seg1, seg3, res ));

	}

	/**
	 * co-linear ends - ends.
	 */
	void test_seg_seg_co_03()
	{

		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.1), Value(0.1));
		b = Vector<Value> (Value (1.13), Value(1.13));

		c = Vector<Value> (Value (1.13), Value(1.13));
		d = Vector<Value> (Value (1.17), Value(1.17));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		//std::cout<<res.point<<std::endl;
		CPPUNIT_ASSERT (res.point == VectorType (1.13, 1.13));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg3, res ));
		CPPUNIT_ASSERT (POINT == res.res_type );
		CPPUNIT_ASSERT (res.point == VectorType (1.13, 1.13));
	}

	/**
	 * Co-linear, return segment. 
	 */
	void test_seg_seg_co_04()
	{
		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.1), Value(0.1));
		b = Vector<Value> (Value (1.14), Value(1.14));

		c = Vector<Value> (Value (1.13), Value(1.13));
		d = Vector<Value> (Value (1.17), Value(1.17));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (SEGMENT == res.res_type );
		CPPUNIT_ASSERT (res.segment == SegmentType (b, c));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg3, res ));
		CPPUNIT_ASSERT (SEGMENT == res.res_type );
		CPPUNIT_ASSERT (res.segment == SegmentType (b, c));
	}

	/**
	 * Co-linear, partially overlap. 
	 */
	void test_seg_seg_co_05()
	{
		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.1), Value(0.1));
		b = Vector<Value> (Value (1.14), Value(1.14));

		c = Vector<Value> (Value (1.13), Value(1.13));
		d = Vector<Value> (Value (1.14), Value(1.14));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (SEGMENT == res.res_type );
		CPPUNIT_ASSERT (res.segment == SegmentType (b, c));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg3, res ));
		CPPUNIT_ASSERT (SEGMENT == res.res_type );
		CPPUNIT_ASSERT (res.segment == SegmentType (b, c));
	}

	/**
	 * Overlap.
	 */
	void test_seg_seg_co_06()
	{
		Vector<Value> a, b ;
		Vector<Value> c, d ;

		a = Vector<Value> (Value (0.1), Value(0.1));
		b = Vector<Value> (Value (1.14), Value(1.14));

		c = Vector<Value> (Value (0.1), Value(0.1));
		d = Vector<Value> (Value (1.14), Value(1.14));

		SegmentType seg1 (a, b);
		SegmentType seg2 (c, d);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg2, res ));
		CPPUNIT_ASSERT (SEGMENT == res.res_type );
		CPPUNIT_ASSERT (res.segment == SegmentType (a, b));

		//Circulate the intersectation.
		SegmentType seg3 (d, c);
		CPPUNIT_ASSERT (true == intersect_seg_seg_2d (seg1, seg3, res ));
		CPPUNIT_ASSERT (SEGMENT == res.res_type );
		CPPUNIT_ASSERT (res.segment == SegmentType (c, d));
	}

	void test_pol_pol_01()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (0.5, 0.5));
		pol2.append_vertex (VectorType (1.5, 0.5));
		pol2.append_vertex (VectorType (1.5, 1.5));
		pol2.append_vertex (VectorType (0.5, 1.5));


		IntersectResult<Value> res;
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		std::cout<<res.polygon;
	}

	void test_pol_pol_02()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (0.5, 0.2));
		pol2.append_vertex (VectorType (1.0, 0.2));
		pol2.append_vertex (VectorType (1.0, 0.8));
		pol2.append_vertex (VectorType (0.5, 0.8));


		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		std::cout<<res.polygon;
	}

	void test_pol_pol_03()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (0.5, 0.5));
		pol2.append_vertex (VectorType (1.0, 0.5));
		pol2.append_vertex (VectorType (1.0, 1.0));
		pol2.append_vertex (VectorType (0.5, 1.0));


		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		std::cout<<res.polygon;
	}

	void test_pol_pol_04()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (1.0, 0.0));
		pol2.append_vertex (VectorType (2.0, 0.0));
		pol2.append_vertex (VectorType (2.0, 1.0));
		pol2.append_vertex (VectorType (1.0, 1.0));


		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		std::cout<<res.segment;
	}

	void test_pol_pol_05()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (1.0, 0.2));
		pol2.append_vertex (VectorType (2.0, 0.2));
		pol2.append_vertex (VectorType (2.0, 0.8));
		pol2.append_vertex (VectorType (1.0, 0.8));


		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		std::cout<<res.segment;
	}

	void test_pol_pol_06()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (1.0, 1.0));
		pol2.append_vertex (VectorType (2.0, 1.0));
		pol2.append_vertex (VectorType (2.0, 2.0));
		pol2.append_vertex (VectorType (1.0, 2.0));


		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		CPPUNIT_ASSERT ( POINT == res.res_type);
	}

	void test_pol_pol_07()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (1.0, 0.5));
		pol2.append_vertex (VectorType (2.0, 0.0));
		pol2.append_vertex (VectorType (2.0, 1.0));
//	pol2.append_vertex (VectorType (2.0, 1.0));

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		CPPUNIT_ASSERT ( POINT == res.res_type);
		//std::cout<<res.point<<std::endl;
	}

	void test_pol_pol_08()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (0.5, 0.0));
		pol2.append_vertex (VectorType (1.0, 0.5));
		pol2.append_vertex (VectorType (0.5, 1.0));
		pol2.append_vertex (VectorType (0.0, 0.5));

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		std::cout<<res.polygon;
	}

	void test_pol_pol_09()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (3.0, 3.0));
		pol2.append_vertex (VectorType (4.0, 3.0));
		pol2.append_vertex (VectorType (4.0, 4.0));
		pol2.append_vertex (VectorType (3.0, 4.0));

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (false == intersect_conv_poly_poly_2d(pol1, pol2, res));
	}

	void test_pol_pol_10()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (0.2, 0.2));
		pol2.append_vertex (VectorType (1.0, 0.5));
		pol2.append_vertex (VectorType (0.2, 0.8));

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		std::cout<<res.polygon;
	}

	void test_pol_pol_11()
	{
		PolygonType pol1 ;
		PolygonType pol2 ;

		pol1.append_vertex (VectorType (0.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 0.0));
		pol1.append_vertex (VectorType (1.0, 1.0));
		pol1.append_vertex (VectorType (0.0, 1.0));

		pol2.append_vertex (VectorType (0.2, 0.2));
		pol2.append_vertex (VectorType (0.9, 0.5));
		pol2.append_vertex (VectorType (0.2, 0.8));

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT ( true == intersect_conv_poly_poly_2d(pol1, pol2, res));
		std::cout<<res.polygon;
	}

	void test_pol_pol_12()
	{
		Vector<Value> p1, q1, r1 ;  // First triangle. 
		Vector<Value> p2, q2, r2 ;  // Second triangle. 

		p1 = Vector<Value> (Value (0.2), Value(0.0));
		q1 = Vector<Value> (Value (1.0), Value(0.0));
		r1 = Vector<Value> (Value (0.2), Value(0.8));

		p2 = Vector<Value> (Value (0.0), Value(0.0));
		q2 = Vector<Value> (Value (1.0), Value(1.0));
		r2 = Vector<Value> (Value (0.0), Value(1.0));

		PolygonType polygon1 , polygon2 ;
		polygon1.append_vertex(p1); 
		polygon1.append_vertex(q1); 
		polygon1.append_vertex(r1);

		polygon2.append_vertex(p2); 
		polygon2.append_vertex(q2); 
		polygon2.append_vertex(r2);

		IntersectResult<Value> res; 
		CPPUNIT_ASSERT (true == intersect_conv_poly_poly_2d (polygon1, polygon2, res ));
		CPPUNIT_ASSERT (POLYGON == res.res_type );
		std::cout<<res.polygon;
	}
private:

};

CPPUNIT_TEST_SUITE_REGISTRATION (Test_intersect_2d);

#endif
